package com.bgtapp;

import android.app.Application;

import com.bgtapp.android_upgrade.UpgradePackage;
import com.facebook.react.ReactApplication;
import com.cboy.rn.splashscreen.SplashScreenReactPackage;
import com.reactnativecomponent.barcode.RCTCapturePackage;
import cn.jpush.reactnativejpush.JPushPackage;
import com.cboy.rn.splashscreen.SplashScreenReactPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import cn.jpush.reactnativejpush.JPushPackage;
import org.pgsqlite.SQLitePluginPackage;
import com.reactnativecomponent.barcode.RCTCapturePackage;    //这是要添加的


import java.util.Arrays;
import java.util.List;


public class MainApplication extends Application implements ReactApplication {

  private boolean SHUTDOWN_TOAST = true;
  private boolean SHUTDOWN_LOG = true;

  private  ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new SplashScreenReactPackage(),
            new RCTCapturePackage(),
            new JPushPackage(!BuildConfig.DEBUG, !BuildConfig.DEBUG),
            new SplashScreenReactPackage(),
              new UpgradePackage(),
              new SQLitePluginPackage(),   // register SQLite Plugin here
              new JPushPackage(SHUTDOWN_TOAST,SHUTDOWN_LOG),
              new RCTCapturePackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  //添加二维码
  public void setReactNativeHost(ReactNativeHost reactNativeHost) {
    mReactNativeHost = reactNativeHost;
  }

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}
